home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib9 / v_11_07 / 1107124a < prev    next >
Encoding:
Text File  |  1995-11-01  |  451 b   |  30 lines

  1. //
  2. // list.h - list interface using a nested class
  3. // with a static data member for counting the object
  4. //
  5.  
  6. class list
  7.     {
  8. public:
  9.     list(unsigned n);
  10.     ~list();
  11.     void add(unsigned n);
  12.     void print();
  13.     static unsigned howmany();
  14. private:
  15.     struct node
  16.         {
  17.         node(unsigned n, node *p);
  18.         unsigned number;
  19.         node *next;
  20.         };
  21.     node *first, *last;
  22.     static unsigned count;
  23.     };
  24.  
  25. inline unsigned list::howmany()
  26.     {
  27.     return count;
  28.     }
  29.  
  30.